import Vue from 'vue'
import Router from 'vue-router'
import Layout from '@/view/Layout'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: '主页',
      redirect: '/index'
    },
    {
      path: '/index',
      component: Layout,
      children: [{
        path: '',
        name: '主页',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/Home')
      }]
    },
    {
      path: '/login',
      name: '登录/注册',
      component: Layout,
      children: [{
        path: '',
        name: '登录/注册',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/Login')
      }]
    },
    {
      path: '/address',
      name: '收货地址',
      component: Layout,
      children: [{
        path: '',
        name: '收货地址',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/address')
      }]
    },
    {
      path: '/addressEdit',
      name: '编辑地址',
      component: Layout,
      children: [{
        path: '',
        name: '编辑地址',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/addressedit')
      }]
    },
    {
      path: '/type',
      component: Layout,
      children: [{
        path: '',
        name: '分类',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/type')
      }]
    },
    {
      path: '/productDetail',
      name: '商品详情',
      component: Layout,
      children: [{
        path: '',
        name: '商品详情',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/product')
      }]
    },
    {
      path: '/order',
      name: '我的订单',
      component: Layout,
      children: [{
        path: '',
        name: '我的订单',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/order')
      }]
    },
    {
      path: '/pay',
      name: '用户结算',
      component: Layout,
      children: [{
        path: '',
        name: '我的订单',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/pay')
      }]
    },
    {
      path: '/cart',
      component: Layout,
      children: [{
        path: '',
        name: '购物车',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/cart')
      }]
    },
    {
      path: '/user',
      component: Layout,
      children: [{
        path: '',
        name: '会员中心',
        component: () =>
          import( /* webpackChunkName: "components" */ '@/view/user')
      }]
    }
  ]
})
